/**
 * desc :
 * User : hjt
 * Date : 2017/1/20
 */
var BaseDao = require("./BaseDao");
var util = require("util");

//空对象
var _instance = null;

module.exports = function(){

    function CourseDao(time){
        this.time = time;
        BaseDao.call(this);         //构造函数继承
        console.log("构造函数");
    }

    util.inherits(CourseDao, BaseDao);          //原型继承

    CourseDao.prototype.save = function(){
        console.log("save:" + this.time);
    }

    CourseDao.prototype.update = function(model){
        console.log("update");
    }

    CourseDao.prototype.deleteById = function(id){
        console.log("deleteById");
    }

    CourseDao.prototype.find = function(options){
        console.log("find");
    }

    //自定义扩展
    CourseDao.prototype.searchCourse = function(){}

    //单例方法
    this.getInstance = function(time){
        if(_instance == null){
            _instance = new CourseDao(time);
        }
        return _instance;
    }
}
